<template>
	<view class="tag">
		<view v-for="(pitem,pindex)  in items">
			<u-cell v-show="pitem.flagTitle || pitem.flagIcon" :border="false" icon="setting-fill">
				<view v-show="pitem.flagTitle" slot="title">{{pitem.name}}</view>
				<image :style="{width: pitem.size + 'px',height: pitem.size + 'px'}" v-show="pitem.flagIcon" class=""
					:src="pitem.image" slot="icon"></image>
			</u-cell>
			<view class="mg-top-10 over">
				<u-grid v-if="pitem.grid" :border="false" :col="pitem.col">
					<u-grid-item @click="targetClick(item)" v-for="(item,index) in pitem.routes">
						<image :style="{width: item.size + 'px',height: item.size + 'px'}" class="" :src="item.image">
						</image>
						<text class="grid-text pd-bottom-10 mg-top-5  font-size-12">{{item.name}}</text>
					</u-grid-item>
				</u-grid>

				<u-cell-group v-if="!pitem.grid">
					<u-cell v-for="(item,index) in pitem.routes" :isLink="getIsLink(item.path)">
						<view v-show="item.flagTitle" slot="title">{{item.name}}</view>
						<image v-show="item.flagIcon" :style="{width: item.size + 'px',height: item.size + 'px'}"
							:src="item.image" slot="icon"></image>
					</u-cell>

				</u-cell-group>
			</view>
		</view>
	</view>
</template>

<script>
	import {

		getFindBySysCategoryList
	} from '@/api/home.js'
	export default {
		props: {
			isRadius: {
				type: Boolean,
				default: true
			},
			type: {
				type: Number,
				default: 0
			}

		},
		data() {
			return {
				items: []

			}
		},
		mounted: function() {
			var type = this.type;
			this.fetchFindByList(type)
		},
		methods: {
			fetchFindByList: function(type) {
				var the = this;
				getFindBySysCategoryList(type).then(res => {
					the.items = res;
				})
			},
			getIsLink(str) {
				console.log("getIsLink", str == undefined)
				return str != undefined;
			},
			getSysless: function(item) {
				let style = {
					width: item.size + 'px',
					height: item.size + 'px'
				};

				return style;

			},
			targetClick(item) {
				console.log(item)
				this.$targetPage(item)
			}
		}
	}
</script>

<style>
	.image {
		width: 50px;
		height: 50px;

	}

	.icon {
		width: 30px;
		height: 30px;

		margin-left: 5px;
		margin-right: 5px;
	}

	.over {
		overflow: hidden;
	}
</style>
